﻿
namespace Sai.Core.Introspection
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    public class FinalizerDeclaration : ISourceCodeProvider
    {
        public FinalizerDeclaration(TypeName typeName)
		{
            this.TypeName = typeName;
		}

        public TypeName TypeName { get; set; }

        public override string ToString()
        {
            return string.Format(
                "~{0}()",
                this.TypeName.Name);
        }

        public SourceCode ToCode()
        {
            SourceCode code = new SourceCode();

            code.Add(new PunctuationTag("~"));
            code.Add(this.TypeName.ToCode());
            code.Add(new PunctuationTag("("));
            code.Add(new PunctuationTag(")"));

            return code;
        }
    }
}
